<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%-- 
    Document   : blank
    Created on : 19.11.2008, 15:33:27
    Author     : Cyclone
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<body>
    <script src="js/labs.js" type="text/javascript"></script>

    <%@include file="systemMessage.jsp" %>

    <div id="box" class="rounded-divcascade">
        <div id="rightnow">
            <h3 class="reallynow">
                <span>
                    Описание практической работы
                </span>
                <br/>
            </h3>
        </div>

        <form id="form" action="EditLab" method="post" class="rounded-formcascade">
            <fieldset>
                <legend>Общее</legend>
                <label for="title">Название : </label>
                <c:choose><c:when test="${mayEdit}">
                        <input name="title" type="text"
                               tabindex="1" value="${lab.title}" />
                    </c:when><c:otherwise>
                        <input name="title" type="text"
                               tabindex="1" value="${lab.title}" readonly="readonly" />
                    </c:otherwise></c:choose>

                    <br />

                    <label for="directionId">Направление : </label>
                <c:choose><c:when test="${mayEdit}">
                        <select tabindex="2" name="directionId" onchange="profileDirectionChanged(event);">
                            <c:forEach items="${directionList}" var="direction">
                                <c:choose><c:when test="${lab.curriculumLevel.curriculumLevel.id == direction.id}">
                                        <option selected="selected" value="${direction.id}">${direction.title}</option>
                                    </c:when><c:otherwise>
                                        <option value="${direction.id}">${direction.title}</option>
                                    </c:otherwise></c:choose>
                            </c:forEach>
                        </select>
                    </c:when><c:otherwise>
                        <input readonly="readonly" tabindex="2"
                               value="${lab.curriculumLevel.curriculumLevel.title}" />
                    </c:otherwise></c:choose>

                    <br />

                    <label for="courseId">Курс : </label>
                <c:choose><c:when test="${mayEdit}">
                        <select tabindex="3" name="courseId" id="courseSelect">
                            <c:forEach items="${directionList}" var="direction">
                                <c:choose><c:when test="${lab.curriculumLevel.curriculumLevel.id == direction.id}">
                                        <optgroup id="optgroupDir_${direction.id}" label="${direction.title}">
                                            <c:forEach items="${direction.curriculumLevels}" var="course">
                                                <c:choose><c:when test="${lab.curriculumLevel.id == course.id}">
                                                        <option selected="selected" value="${course.id}">
                                                            ${course.title}
                                                        </option>
                                                    </c:when><c:otherwise>
                                                        <option value="${course.id}">
                                                            ${course.title}
                                                        </option>
                                                    </c:otherwise></c:choose>
                                            </c:forEach>
                                        </optgroup>
                                    </c:when><c:otherwise>
                                        <optgroup id="optgroupDir_${direction.id}" label="${direction.title}" style="display: none;">
                                            <c:forEach items="${direction.curriculumLevels}" var="course">
                                                <option value="${course.id}">
                                                    ${course.title}
                                                </option>
                                            </c:forEach>
                                        </optgroup>
                                    </c:otherwise></c:choose>
                            </c:forEach>
                        </select>
                    </c:when><c:otherwise>
                        <input value="${lab.title}" tabindex="3" readonly="readonly" />
                    </c:otherwise></c:choose>

                    <br />

                    <label for="number">Номер : </label>
                <c:choose><c:when test="${mayEdit}">
                        <input name="number" type="text"
                               tabindex="4" value="${lab.numeral}" style="width: 210px;" />
                    </c:when><c:otherwise>
                        <input name="number" type="text" readonly="readonly"
                               tabindex="4" value="${lab.numeral}" style="width: 210px;" />
                    </c:otherwise></c:choose>

                    <br />

                    <label for="description">Описание : </label>
                <c:choose><c:when test="${mayEdit}">
                        <textarea id="textAreaDescription" class="taWysiwyg" tabindex="5" name="description" style="height: 50px;" onmouseover="textAreaFocus();" onmouseout="textAreaBlur();">${lab.description}</textarea>
                    </c:when><c:otherwise>
                        <textarea id="textAreaDescription" class="taWysiwyg" readonly="readonly" tabindex="5" name="description" style="height: 50px;" onmouseover="textAreaFocus();" onmouseout="textAreaBlur();">${lab.description}</textarea>
                    </c:otherwise></c:choose>
                        <br/>
                    <a href="javascript:" class="goWysiwyg">форматировать текст</a>

                    <input name="labId" type="hidden" value="${lab.id}">

                <c:if test="${sessionScope.roles.admin || sessionScope.roles.tutor}">
                    <p align="center">
                        <a href="Course?id=${lab.curriculumLevel.id}"><input style="width: 48%" type="button" value="Перейти к курсу"></a>
                        <input  style="width: 48%" type="button" value="Удалить практическую работы" onclick="deleteLab(${lab.id}, '${lab.title}');" style="width: 25%;"/>
                    </p>
                </c:if>

            </fieldset>

            <div align="center">
                <c:if test="${mayEdit}">
                    <input id="button1" type="submit" tabindex="20" value="Сохранить" />
                    <input id="button2" type="reset" tabindex="21" value="Отменить" /> <!-- onclick="window.location.reload();" />-->
                </c:if>
                <br />
                <c:choose><c:when test="${sessionScope.roles.admin || sessionScope.roles.tutor}">
                        <a href="Labs"><input id="button2" style="width: 50%;" type="button" tabindex="22" value="К списку практических работ" /></a>
                        </c:when><c:otherwise>
                        <a href="Curriculum"><input id="button2" style="width: 50%;" type="button" tabindex="22" value="К учебному журналу" /></a>
                        </c:otherwise></c:choose>
            </div>

        </form>
    </div>
    <script type="text/javascript">
        $(document).ready(function(){
            $("#liLabs").addClass("current");
            $('div#top-panel p').text('Свойства практической работы');
        });
    </script>
</body>

